<%@ page import= "model.filemanager.MediaList" %>
<%@ page import ="com.google.appengine.api.datastore.Entity" %>
<%@ page import= "java.util.Iterator" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import ="com.google.appengine.api.users.UserService" %>
<%@ page import ="com.google.appengine.api.users.UserServiceFactory" %>

 <%
 String type = request.getParameter("type");
 String list = request.getParameter("list");
 UserService userService = UserServiceFactory.getUserService();
 User user = userService.getCurrentUser();
 
 boolean outOfList = (type==null || list==null || list.length()==0 || list.equals("-1"));
 %><div id="listTabsDiv"><a href="javascript:listNavigate('');" <%= outOfList ? "class=\"selected\"" : "" %>>All</a><%
 if (type != null)
 {
	 Iterator<Entity> iter = MediaList.getLists(type, user.getEmail()).iterator();
	 while(iter.hasNext()){
		 Entity mList = iter.next();
		 %><div  id="<%= mList.getKey().getId() %>" class='dropClass'><a href="javascript:listNavigate('<%=mList.getKey().getId() %>')" class='dropClass <%
				 	if(list != null) if(list.equals(String.valueOf(mList.getKey().getId()))){%> selected<%}
		 %>'><%= mList.getProperty("name") %></a></div><%
	 }
 }
 %>
 </div>
<div id="playlistcontrols">
	<div id="addPlaylist"><input id="newListName" type="text" value="newPlayList"/><a href="javascript:addNewList()" class="reg_button">
	<img src="../images/plus.gif"/></a></div>
	
	<%if(!outOfList){%>
	<div id="removePlaylist"><a href="javascript:removeCurrentList()" class="reg_button">Delete Playlist </a></div>
	<%} %>
</div>

